# coding=utf-8

from selenium import webdriver
import time
driver = webdriver.Firefox()
#2.输入iwebshop网址
driver.get('http://localhost:8888/iwebshop')
driver.maximize_window()  #窗口最大化

driver.implicitly_wait(8)
time.sleep(1)
driver.find_element_by_link_text(u"免费注册").click()
driver.find_element_by_name("email").send_keys('123@qq.com')
driver.find_element_by_name("username").clear()
driver.find_element_by_name("username").send_keys('zhang1')
driver.find_element_by_name("password").clear()
driver.find_element_by_name("password").send_keys(123456)
driver.find_element_by_name("repassword").clear()
driver.find_element_by_name("repassword").send_keys(123456)
a=driver.find_element_by_id("captchaImg").text

driver.find_element_by_class_name("gray_s").send_keys(a)
driver.find_element_by_xpath(u"//input[@value='同意一下条款，提交']").click()